<?php

if (!defined('WPSR_ACCESS')) { exit; }


require_once "inc.thumb.php";



/**
 * WPsrThumb class.
 * 
 * @extends WPsrAdm
 */
class WPsrThumb extends WPsrAdm
{



	/**
	 * makethumbnail function.
	 * 
	 * @access public
	 * @param string $file
	 * @param string $output
	 * @param int $size. (default: 100)
	 * @param int $quality. (default: 100)
	 * @param bool $doCrop. (default: true)
	 * @param array $crop. (default: array(2, 1, 100, 100, 100, 100)
	 * @param string $filename
	 * @param bool $doWM. (default: false)
	 * @return void
	 */
	function makethumbnail($file, $output, $size = 100, $quality = 100, $doCrop = true, $crop = array(2, 1, 100, 100, 100, 100), $filename, $doWM = false ) {
		$thumb = new easyphpthumbnail;
		$thumb->Thumbsize = $size;
		if ($doCrop) {
			$thumb->Cropimage = $crop;
		}
		if ($doWM) {
			//$thumb->Watermarkpng = WPSR_FILEPATH.'gfx/watermark2.png';
			//$thumb->Watermarkpng = WPSR_FILEPATH.'gfx/'.$size.'.png';
			$WM = 'WPSR_WM_POS_'.$size;
/*
			if (defined($WM)) {
				$thumb->Watermarkposition = $WM;
			}
			else {
				$thumb->Watermarkposition = WPSR_WM_POS;
			}
*/
			//$thumb->Watermarkposition = WPSR_WM_POS;
			//$thumb->Watermarktransparency = WPSR_WM_TRANSP;	
		}
		$thumb->Quality = $quality;
		$thumb->Inflate = false;
		$thumb->Chmodlevel = '0775';
		$thumb->Thumblocation = $output;
		$thumb->ImageNewName = $filename;
		$thumb->Thumbprefix = '';
		$thumb->Createthumb($file, 'file');
	}


}


?>